﻿using Microsoft.AspNetCore.Authorization;
using MyWeb.Business.Base;
using MyWeb.Common.Helper;
using MyWeb.Model;
using MyWeb.Model.Dto;
using MyWeb.Model.Models;
using MyWeb.Model.User;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MyWeb.Business.System
{
    /// <summary>
    /// 菜单管理
    /// </summary>
    public interface IPermissionService:IBaseBusiness<Permission>
    {
        /// <summary>
        /// 分页获取菜单列表
        /// </summary>
        /// <param name="page">页码</param>
        /// <param name="key">搜索文本</param>
        /// <param name="pageSize">页码大小</param>
        /// <returns></returns>
        Task<PageModel<PermissionDto>> Get(int page = 1, string key = "", int limit = 50);

        /// <summary>
        /// 获取菜单表格数
        /// </summary>
        /// <param name="pid"></param>
        /// <param name="key"></param>
        /// <returns></returns>
        Task<List<PermissionDto>> GetTreeTable(long pid = 0, string key = "");

        /// <summary>
        /// 获取所有菜单数
        /// </summary>
        /// <returns></returns>
        Task<PermissionTree> GetPermissionTree(long pid = 0);

        /// <summary>
        /// 获取用户菜单
        /// </summary>
        /// <param name="uid"></param>
        /// <returns></returns>
        Task<NavigationBar> GetNavigationBar(long uid = 12);

        /// <summary>
        /// 获取角色菜单
        /// </summary>
        /// <param name="rid">角色Id</param>
        /// <returns></returns>
        Task<List<long>> GetRoleNavigationBar(long rid = 25);

        /// <summary>
        /// 保存菜单权限分配
        /// </summary>
        /// <param name="assign"></param>
        /// <returns></returns>
        Task<object> PutPermission(AssignView assign);
        /// <summary>
        /// 删除菜单
        /// </summary>
        /// <param name="id">菜单Id</param>
        /// <returns></returns>
        Task<bool> DelPermission(long id);
        /// <summary>
        /// 添加菜单
        /// </summary>
        /// <param name="per"></param>
        /// <returns></returns>
        Task<bool> InsertPermission(Permission per,SysUserInfo? userInfo);
        /// <summary>
        /// 修改菜单
        /// </summary>
        /// <param name="per"></param>
        /// <returns></returns>
        Task<bool> UpdatePermission(Permission per,SysUserInfo? userInfo);
        /// <summary>
        /// 获取菜单列表
        /// </summary>
        /// <returns></returns>
        Task<List<PermissionListDto>> GetPermissionList();
    }
}
